﻿using System.Data;
using System.Windows.Forms;
namespace JCodeManage
{
    public partial class CodeList : Form
    {
        JCode.BLL.Code bll = new JCode.BLL.Code();
        protected BindingSource bs = new BindingSource();
        MDIParent1 mp;
        public CodeList(int CateId,MDIParent1 v)
        {
            InitializeComponent();
            BindCode(CateId);
            mp = v;
        }
        private void BindCode(int CateId)
        {
            DataSet ds = bll.GetList(" CategoryID="+CateId);
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource = ds.Tables[0];
            ds.Dispose();

        }
      
        private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {

          string Id=  dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
         //  MessageBox.Show(Id);
          mp.DisplayCodeInfoForm(int.Parse(Id));
        }
    }
}
